Skip to content

Feat/lab query plan#7892

Open
mskorokhodov wants to merge 11 commits intomainfrom
feat/lab-query-plan
Open

Feat/lab query plan#7892
mskorokhodov wants to merge 11 commits intomainfrom
feat/lab-query-plan

Conversation

@mskorokhodov
Copy link
Copy Markdown
Collaborator

@mskorokhodov mskorokhodov commented Mar 20, 2026

Background

Description

Hive Laboratory to render Hive Router query plan if it's part of response

Screen.Recording.2026-04-06.at.22.04.27.mov

Checklist

  • Input validation
  • Output encoding
  • Authentication management
  • Session management
  • Access control
  • Cryptographic practices
  • Error handling and logging
  • Data protection
  • Communication security
  • System configuration
  • Database security
  • File management
  • Memory management
  • Testing

@mskorokhodov mskorokhodov marked this pull request as draft March 20, 2026 21:23
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the GraphQL Laboratory by integrating a comprehensive query plan visualization feature. Users can now inspect the execution plan of their GraphQL queries, viewing it either as a formatted text output or an interactive visual flow diagram. This addition is complemented by new configuration options in the laboratory settings, allowing for fine-grained control over network requests, subscription protocols, and introspection behavior, ultimately providing a more powerful and insightful development experience.

Highlights

  • Query Plan Visualization: Introduced a new feature to visualize GraphQL query plans within the laboratory environment, offering both text and interactive visual representations.
  • Graph Flow Component: Implemented a reusable Flow component for rendering directed graphs, which is utilized by the visual query plan display.
  • Expanded Laboratory Settings: Added new configuration options for fetch behavior (timeout, retry, use GET for queries), subscription protocols, and introspection settings.
  • Dependency Updates: Updated and added graph-related dependencies, specifically dagrejs and @dagrejs/dagre, to support graph layout algorithms.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-hive/laboratory 0.1.4-alpha-20260407134726-7badd8a3665b019fc542624f2c6d2f41aac255f5 npm ↗︎ unpkg ↗︎
@graphql-hive/render-laboratory 0.1.4-alpha-20260407134726-7badd8a3665b019fc542624f2c6d2f41aac255f5 npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

🐋 This PR was built and pushed to the following Docker images:

Targets: build

Platforms: linux/amd64

Image Tag: 7badd8a3665b019fc542624f2c6d2f41aac255f5

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a query plan visualizer, a significant feature. My review focuses on improving correctness, performance, and adherence to the repository's guidelines. I've identified several areas for improvement, including dependency management, performance optimization in the new flow component, safer data handling and parsing, and ensuring robust UI rendering. The most critical issues relate to dependency correctness and the lack of data validation for the query plan, which could lead to runtime errors.

Comment on lines +663 to +688
export const queryPlanNodeIcon = (
kind: QueryPlanNode['kind'],
): ((props: LucideProps) => React.ReactNode) => {
return (props: LucideProps) => {
switch (kind) {
case 'Root':
return <GraphQLIcon {...props} />;
case 'Fetch':
return <Box {...props} />;
case 'BatchFetch':
return <Boxes {...props} />;
case 'Flatten':
return <Layers2Icon {...props} />;
case 'Sequence':
return <ListOrderedIcon {...props} />;
case 'Parallel':
return <NetworkIcon {...props} />;
case 'Condition':
return <GitForkIcon {...props} className={cn('rotate-90', props.className)} />;
case 'Subscription':
return <UnlinkIcon {...props} />;
case 'Defer':
return <ClockIcon {...props} />;
}
};
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The switch statement in queryPlanNodeIcon is missing a default case. If a new node kind is added in the future, this function will return undefined and cause a rendering error. Adding a default case that returns null or a fallback icon will make this component more robust.

export const queryPlanNodeIcon = (
  kind: QueryPlanNode['kind'],
): ((props: LucideProps) => React.ReactNode) => {
  return (props: LucideProps) => {
    switch (kind) {
      case 'Root':
        return <GraphQLIcon {...props} />;
      case 'Fetch':
        return <Box {...props} />;
      case 'BatchFetch':
        return <Boxes {...props} />;
      case 'Flatten':
        return <Layers2Icon {...props} />;
      case 'Sequence':
        return <ListOrderedIcon {...props} />;
      case 'Parallel':
        return <NetworkIcon {...props} />;
      case 'Condition':
        return <GitForkIcon {...props} className={cn('rotate-90', props.className)} />;
      case 'Subscription':
        return <UnlinkIcon {...props} />;
      case 'Defer':
        return <ClockIcon {...props} />;
      default:
        return null;
    }
  };
};

@mskorokhodov mskorokhodov force-pushed the feat/lab-query-plan branch 5 times, most recently from bae6f49 to 143a2f0 Compare March 23, 2026 22:18
@mskorokhodov mskorokhodov marked this pull request as ready for review March 23, 2026 22:21
@mskorokhodov mskorokhodov force-pushed the feat/lab-query-plan branch 5 times, most recently from 28be2aa to 4dcadfd Compare March 24, 2026 11:59
@theguild-bot theguild-bot temporarily deployed to development March 24, 2026 13:07 Inactive
@n1ru4l n1ru4l marked this pull request as draft March 25, 2026 07:36
@mskorokhodov mskorokhodov force-pushed the feat/lab-query-plan branch 3 times, most recently from 3542566 to cde3cb8 Compare March 26, 2026 15:00
@theguild-bot theguild-bot had a problem deploying to development March 30, 2026 08:16 Failure
@theguild-bot theguild-bot temporarily deployed to development March 30, 2026 08:37 Inactive
@theguild-bot theguild-bot temporarily deployed to development March 30, 2026 10:51 Inactive
@theguild-bot theguild-bot temporarily deployed to development March 30, 2026 18:11 Inactive
@mskorokhodov mskorokhodov force-pushed the feat/lab-query-plan branch from f680cd9 to b7bde86 Compare April 6, 2026 20:06
@mskorokhodov mskorokhodov marked this pull request as ready for review April 6, 2026 20:07
@mskorokhodov mskorokhodov force-pushed the feat/lab-query-plan branch from b7bde86 to ca3cf53 Compare April 6, 2026 20:12
@theguild-bot theguild-bot temporarily deployed to development April 6, 2026 20:46 Inactive
@theguild-bot theguild-bot temporarily deployed to development April 7, 2026 09:22 Inactive
@mskorokhodov mskorokhodov force-pushed the feat/lab-query-plan branch from 359f79c to 9c8eb6b Compare April 7, 2026 10:37
@theguild-bot theguild-bot temporarily deployed to development April 7, 2026 11:07 Inactive
@mskorokhodov mskorokhodov force-pushed the feat/lab-query-plan branch from 9c8eb6b to 586c363 Compare April 7, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants